<include file="Public:header" />
	<div class="container">
		<div class="page-header">
			<select id="select1" onchange="changeContent()">
				<option>--{:L('CHOOSE_TO_VIEW_THE_CONTENT')}--</option>
				<option value="1">{:L('PRODUCT_LIST')}</option>
				<option value="2">{:L('PRODUCT_CLASSIFICATION_MANAGEMENT')}</option>
				<option value="3">{:L('PRODUCT_SALES_STATISTICS')}</option>
			</select>
			<div class="pull-right">
				<a class="btn btn-primary" href="{:U('product/add')}">{:L('ADD_PRODUCT')}</a>
				&nbsp; <a class="btn btn-primary" href="javascript:$('#dialog-message1').dialog('open');$('#dialog-message1').load('{:U('product/category_add')}');">{:L('ADD_PRODUCT_CATEGORIES')}</a>
			</div>
		</div>
		<include file="Public:alert" />
		<div class="row">
			<div class="span12">
				<form class="form-inline">
				<input type="text" id="year" name="year" class="Wdate" id="d243" onClick="WdatePicker({skin:'twoer',dateFmt:'yyyy'})"/>
				<a class="btn btn-primary btn-small" href="#">{:L('ACCORDING_TO_THE_YEARS_TO_SEE')}</a> &nbsp;
				<input type="text" id="moon" name="moon" id="d243" class="Wdate" onClick="WdatePicker({skin:'twoer',dateFmt:'yyyy/MM'})"/>
				<a class="btn btn-primary btn-small" href="#">{:L('ACCORDING_TO_THE_MONTH_TO_SEE')}</a> &nbsp;
				<input type="text" id="product_name" name="product_name" onclick="javascript: $('#dialog-message').dialog('open');$('#dialog-message').load('{:U('product/index')}?by=add');"/> 
				<a class="btn btn-primary btn-small"  href="">{:L('TO_VIEW_THE_PRODUCTS_ACCORDING_TO')}</a>
				</form>
			</div>
			<div class="span12">
				<table class="table" width="95%" border="0" cellspacing="1" cellpadding="0"> 
					<thead>
						<tr>
							<th>{:L('BUSINESS_OPPORTUNITY')}</th>
							<th>{:L('PRODUCT')}</th>
							<th>{:L('CUSTOMER')}</th>
							<th>{:L('SALES_VOLUME')}</th>
							<th>{:L('COST')}</th>
							<th>{:L('SELLING_PRICE')}</th>
							<th>{:L('PROFIT')}</th>
							<th></th>
						</tr>
					</thead>
					<tbody>
						<volist name="salesList" id="vo">
							<tr>
								<td>
									{$vo.business_name}
								</td>
								<td>
									{$vo.product_name}
								</td>
								<td>
									{$vo.customer_name} 
								</td>
								<td>
									{$vo.product_amount}
								</td>
								<td>
									{$vo.cost_price}
								</td>
								<td>
									{$vo.sales_price}
								</td>
								<td>
									{$vo.profit}
								</td>
								<td>&nbsp;
								</td>																
							</tr>
						</volist>
					</tbody>
				</table>
			</div> <!-- End #tab1 -->	
		</div> <!-- End .content-box-content -->	
	</div>
	<div id="dialog-message" title="{:L('SELECT_A_PRODUCT')}">loading...</div>
	<div id="dialog-message1" title="{:L('ADD_PRODUCT_CATEGORIES')}">loading...</div>

<include file="Public:footer" />	
<script type="text/javascript">
	function changeContent(){
		a = $("#select1  option:selected").val();
		if(a=='1'){
			window.location.href="{:U('product/index')}";
		}else if(a=='2'){
			window.location.href="{:U('product/category')}";
		}else if(a=='3'){
			window.location.href="{:U('product/count')}";
		}
	}

	$('#dialog-message1').dialog({
		autoOpen: false,
		modal: true,
		width: 600,
		maxHeight: 400,
		position :["center",100]
	});
	
	function deleteConfirm(id,name)
	{
		var r=confirm("{:L('SURE_TO_DELETE_CLASSIFICATION')}"+name+"?");
		if (r==true)
		{
			window.location="/Product/deleteCategory?id="+id;
		}
	}
	
	$("#dialog-message").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
    buttons: { 
			"Ok": function () {
				var item = $('input:radio[name="owner"]:checked').val();
				var name = $('input:radio[name="owner"]:checked').next().html();
				$('#owner_id').val(item);
				$('#owner_name').val(name);
				$(this).dialog("close"); 
			},
			"Cancel": function () {
				$(this).dialog("close");
			}
		}
	});
	
</script>

